#include "MySqlPrimaryKey.h"
#include "../visitor/MySqlASTVisitor.h"
#include "../../../../utils/listTran.h"
#include "../../../ast/statement/SQLSelectOrderByItem.h"

MySqlPrimaryKey::MySqlPrimaryKey()
{
  dbType = DbType_ptr(new DbType(&DbType::mysql));
}

void MySqlPrimaryKey::accept0(MySqlASTVisitor_ptr visitor)
{
  if (visitor->visit(SharedObject(MySqlPrimaryKey)))
  {
    acceptChild(visitor, this->getName());
    SQLObject_list_ptr tmp = ListTran::tran_class<SQLSelectOrderByItem, SQLObject>(SQLUnique::getColumns());
    acceptChild(visitor, tmp);
  }
  visitor->endVisit(SharedObject(MySqlPrimaryKey));
}

SQLObject_ptr MySqlPrimaryKey::clone()
{
  SQLObject_ptr clone_tmp = std::shared_ptr<MySqlPrimaryKey>(new MySqlPrimaryKey());
  std::shared_ptr<MySqlPrimaryKey> x = std::dynamic_pointer_cast<MySqlPrimaryKey>(clone_tmp);
  // MySqlPrimaryKey *x = new MySqlPrimaryKey();
  cloneTo(x);
  return x;
}
